<#assign module="notice"/>

<@override name="header">
<link rel="stylesheet" href="${ctx}/assets/css/bootstrap-multiselect.css">
<link rel="stylesheet" href="${ctx}/assets/css/datetimepicker.css">
<link rel="stylesheet" href="${ctx}/assets/css/phonegift.css">
<link rel="stylesheet" href="${ctx}/assets/css/jquery.minicolors.css">
</@override>
<@override name="body">
	
	<div class="row">
		<div class="col-md-12">
			<div class="panel panel-default" style="min-height:610px;">
				<div class="panel-heading">
					添加输入手机领取优惠活动
					<#if type=="cash">
						(返现)
					<#elseif type="coupon">
						(返券)
					</#if>
					<label class="control-label"><font color="red">（带*表示必填项）</font></label>
			    </div>
			    <div class="panel-body">
			    	<div class="col-sm-3">
						<div class="swiper-container">
						    <div class="page" id="backage_color" style="background-color:#d41501;background-size:100% 100%;">
						    	<img class="bgImage" id="image" src="${ctx}/assets/img/phonegift_1.png" alt="bg_1"/>
						    	<div class="master-min">
						    		<input type="text" class="fomtor" placeholder="请输入手机号码"/>
						    		<button type="button" class="pabutton">确认领取</button>
						    	</div>
						    	<div style="color:#ffffff;text-align:center">
						    		<h4>活动规则</h4>
						    	</div>
						    	<div class="content" id="contentBody">
						    	</div>
						    </div>
						</div>
			    	</div>
			    	
			    	
			    	<div class="col-sm-9">
	    				<form id="submit_form" action="${ctx}/activity/create" class="form-horizontal" method="post">
		    				<input type="hidden" id="activityEvent" name="activityEvent" value="phoneGift" />
			            	<@shiro.isMainCompany>
			               		<div class="form-group">
				                    <label class="col-sm-3 control-label"><em>*</em>所属公司：</label>
				                    <div class="col-sm-3">
				                    	<input type="hidden" id="companyNames" name="companyNames"  />
				                    	<select class="form-control" id="companyIds" name="companyIds" multiple="multiple" required>
				                    		<#if companys??>
				                    			<#list companys as company>
				                    				<option value="${company.id}">${company.abbreviation?if_exists}</option>
				                    			</#list>
				                    		</#if>
				                    	</select>
				                    </div>
				                </div>
			               	</@shiro.isMainCompany>
				              
		              		<div class="form-group">
			                    <label class="col-sm-3 control-label">客户等级：</label>
			                    <div class="col-sm-3">
			                    	<input type="hidden" id="gradeNames" name="gradeNames" value="" />
			                    	<select class="form-control" id="gradeIds" name="gradeIds" value="" multiple="multiple" required>
			                    		<#if grades??>
			                    			<#list grades as grade>
			                    				<option value="${grade.id}">${grade.name?if_exists}</option>
			                    			</#list>
			                    		</#if>
			                    	</select>
			                    </div>
			                </div>
							    
						    <div class="form-group">
			                    <label class="col-sm-3 control-label"><em>*</em>客户类型：</label>
			                    <div class="col-sm-3">
			                    	<select class="form-control" id="activityTarget" name="activityTarget" required>
			                    		<option value="all">所有客户</option>
			                    		<option value="passenger">个人客户</option>
			                    		<option value="enterprise">企业客户</option>
			                    	</select>
			                    </div>
			                </div>
			                
			                <input type="hidden" id="activityType" name="activityType" value="${type}" />
			                
			              
			                
			                
					    <#if type=="cash">
			                <div class="form-group">
			                    <label class="col-sm-3 control-label"><em>*</em>返现金额：</label>
			                    <div class="col-sm-3">
			                    	<input class="form-control" id="money" name="money" type="text"/>
			                    </div>
			                </div>
		                <#elseif type=="coupon">
			                <div class="form-group coupon_div" id="first_coupon_div">
			                	<input type="hidden" id="couponIds" name="couponIds" >
			                	<input type="hidden" id="couponAmounts" name="couponAmounts">
			                	
			                    <label class="col-sm-3 control-label"><em>*</em>优惠劵：</label>
			                    <div class="col-sm-3">
			                    	<select class="form-control couponRule_select">
			                    		<option value="">--请选择--</option>
			                    		<#if coupons??>
				                    		<#list coupons as coupon>
				                    			<option value="${coupon.id}" eachLimit="${coupon.eachLimit}" numerAll="${coupon.number}">
				                    				${coupon.title?if_exists}
				                    				<#if coupon.timeStatus==0>
														(未开始)
													<#elseif coupon.timeStatus==1>
														(使用中)
													</#if>
				                    			</option>
				                    		</#list>
			                    		</#if>
			                    	</select>
			                    </div>
			                    <label style="float:left;" class="control-label"><em>*</em>数量：</label>
			                    <div class="col-sm-1">
			                    	<input class="form-control couponAmount" data-toggle="tooltip"  title="（小提示：所填数量为当前优惠券每人领取数量）" type="number" min="1" value="1"/>
			                    </div>
			                    <div class='col-sm-1'>
				                    <button type="button" id="add_coupon_rule" class="btn btn-default">
									  <span class="glyphicon glyphicon-plus-sign"></span> 添加
									</button>
								</div>
		                    </div>
		                </#if>
		                    
		                    <div class="form-group">
						    	<label class="col-sm-3 control-label">订单类型：</label>
			                	<div class="col-sm-3">
			                		<select class="form-control" id="orderType" name="orderType" >
			                    		<option value="">不限制</option>
			                    		<@daijia>
			                    		<option value="daijia">代驾</option>
			                    		</@daijia>
			                    		<@zhuan>
			                    		<option value="zhuanche">专车</option>
			                    		</@zhuan>
			                    		<@freight>
			                    		<option value="freight">货运</option>
			                    		</@freight>
			                    		<@zhuanxian>
			                    		<option value="zhuanxian">专线</option>
			                    		</@zhuanxian>
			                    	</select>
								</div>
						    </div>
			                    
		                    <div class="form-group" id="cash_div" >
			                    <label class="col-sm-3 control-label">每完成订单：</label>
			                    <div class="col-sm-3">
			                    	<div class="input-group">
				                    	<input class="form-control" id="completeTimes" name="completeTimes" type="number"  />
				                    	<span class="input-group-addon">次</span>
				                    </div>
			                    </div>
			                </div>
				                
				                
				            <div class="form-group">
			                    <label class="col-sm-3 control-label"><em>*</em>限制参与：</label>
			                    <div class="col-sm-3">
			                    	<div class="input-group">
						            	<input class="form-control" id="restriction" name="restriction" type="number" min="0" value="1" required/>
						            	<span class="input-group-addon">次</span>
					                </div>
			                    </div>
			                    <label class="control-label"><em>0不限制参与次数</em></label>
			                </div>    
				                
			                
							    
						    <div class="form-group">
			                    <label class="col-sm-3 control-label"><em>*</em>有效期：</label>
			                    <div class="col-sm-3">
			                    	<input class="form-control" id="start" name="start" type="text" required/>
			                    	<span class="help-block">活动的开始时间，由该日期凌晨开始</span>
			                    </div>
			                    <label style="float:left;" class="control-label">-</label>
			                    <div class="col-sm-3">
			                    	<input class="form-control" id="end" name="end" type="text"/>
			                    	<span class="help-block">活动的结束时间，由该日期凌晨结束，不填写则不限制结束时间</span>
			                    </div>
			                </div>
			                
			                <div class="form-group">
		    					<label class="col-sm-3 control-label">活动规则：</label>
		    					<div  class="col-sm-7">
		    						<textarea class="form-control" cols="40" id="activityContent"  name="activityContent" rows="5" required></textarea>
		    					</div>
		    				</div>
		    				
    						<div class="form-group">
		    					<label class="col-sm-3 control-label"><em>*</em>活动背景图片：</label>
		    					<div class="col-sm-6" >
									<input type="hidden" name="imgsUrl" id="imgsUrl"/>
									<div class="row">
										<div class="col-sm-6">
											<span class="help-block">建议图片大小1920x3000</span>
										</div>
									</div>
									<div class="tabbable"> 
										<ul class="nav nav-tabs">
										 	<li class="active"><a href="#tab1" data-toggle="tab">系统内置</a></li>
										 	<li><a href="#tab2" data-toggle="tab">自定义</a></li>
										</ul>
										
										<div class="tab-content">
											<div class="tab-pane fade in active" id="tab1">
													 <img class="img" name="hide" src="${ctx}/assets/img/phonegift_1.png" bath-src="assets/img/phonegift_1.png" id="phonegift_1" backgroud="#d41501" width="80" height="100" />
													 <img class="img" name="hide" src="${ctx}/assets/img/phonegift_2.jpg" bath-src="assets/img/phonegift_2.jpg" id="phonegift_2" backgroud="#8eafef" width="80" height="100"/>
													 <img class="img" name="hide" src="${ctx}/assets/img/phonegift_3.jpg" bath-src="assets/img/phonegift_3.jpg" id="phonegift_3" backgroud="#f53d47" width="80" height="100"/>
											</div>
											<div class="tab-pane fade" id="tab2">
												<div id="custom">
													<img src="${ctx}/assets/img/add2.png" id="shareImage_btn" width="80" height="100" style="display:none;"/>
													<img src="${ctx}/assets/img/add.png" id="shareImage_btn2"  width="80" height="100" />
													<input style="display:none;" type="file" name="imgFile" id="activityImage"  accept=".bmp,.gif,.jpeg,.jpg,.png" />
												</div>
											</div>
										</div>
									</div>
								</div>
		    				</div>
				            
				             <div class="form-group" style="display:none;" id="backgroudColor_div">
			                    <label class="col-sm-3 control-label"><em>*</em>背景颜色：</label>
			                    <div class="col-sm-3">
			                    	<input name="backgroudColor" id="backgroudColor" class="form-control minicolors-input"  onChange="backgroundColor(this.value)" type="text"/>
			                    </div>
			                </div>
			                
			                <div class="form-group">
					    	<label class="col-sm-3 control-label">通知方式：</label>
		                	<div class="col-sm-9">
		                		<p class="form-control-static">
									<label style="padding-right:12px;">
									  <input type="checkbox" name="messageType" value="sms" checked="checked"/> 短信
									</label>
									<label style="padding-right:12px;">
									  <input type="checkbox" name="messageType" value="message" checked="checked"/> 应用通知
									</label>
								</p>
							</div>
					    </div>
				             
			                <div class="form-group" style="margin-left:10px;">
				                  <label class="col-sm-3 control-label"></label>
				                  <input id="submit_button" type="button" class="btn btn-primary" value="确定">
				                  <input type="button" class="btn btn-default" onclick="window.location.href = '${ctx}/activity/list?event=phoneGift&type=${type}';" value="返回">
				            </div>
						</form>
							
					</div>
        		</div>
			</div>
		</div>
	</div>

</@override>
<@override name="footer">
<script type="text/javascript">
	$("#numbers").tooltip($("[data-toggle='tooltip']").tooltip());
	var main=false;
	<@shiro.isMainCompany>
		main=true;
	</@shiro.isMainCompany>
	var eachLimit;
</script>
<script src="${ctx}/assets/kindeditor/kindeditor-all-min.js"></script>
<script src="${ctx}/assets/kindeditor/lang/zh_CN.js"></script>
<script src="${ctx}/assets/js/jquery.minicolors.min.js"></script>
<script src="${ctx}/assets/js/bootstrap-multiselect.js"></script>
<script src="${ctx}/assets/kindeditor/kindeditor-all-min.js"></script>
<script src="${ctx}/assets/kindeditor/lang/zh_CN.js"></script>
<script src="${ctx}/assets/js/bootstrap-datetimepicker.min.js"></script>
<script src="${ctx}/assets/js/bootstrap-datetimepicker.zh-CN.js"></script>
<script src="${ctx}/assets/js/datepicker.js"></script>
<script src="${ctx}/assets/js/ajaxfileupload.js"></script>
<script src="${ctx}/assets/js/activity/addphonegift.js"></script>
</@override>
<@extends name="../layout.ftl"/>